package Hxw3DEngine.core.materials.shader {

	import Hxw3DEngine.core.Resource.texture.ResourceTexture;
	import Hxw3DEngine.core.materials.shader.filters.TextureMapFilter;
	import Hxw3DEngine.core.materials.shader.Shader3D;

	// todo:每个Shader都会根据纹理的格式，产生 RGB,RGBA,DXT1,DXT5四个版本。
	public class DiffuseShader extends Shader3D {
		
		private static var _instance : DiffuseShader;
		
		private var filter : TextureMapFilter;
		
		public function DiffuseShader() {
			super([]);
			this.filter = new TextureMapFilter(null);
			this.addFilter(filter);
		}
		
		public function set texture(texture:ResourceTexture) : void {
			this.filter.texture = texture;
		}
		
		public function tillingOffset(repeatX:Number, repeatY:Number, offsetX:Number, offsetY:Number) : void {
			this.filter.offsetX = offsetX;
			this.filter.offsetY = offsetY;
			this.filter.repeatX = repeatX;
			this.filter.repeatY = repeatY;
		}
		
		public static function get instance() : DiffuseShader {
			if (!_instance) {
				_instance = new DiffuseShader();
			}
			return _instance;
		}
		
	}
}
